/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author PARINYA
 */
@Entity
@Table(name = "m_user")
@NamedQueries({
    @NamedQuery(name = "MUser.findAll", query = "SELECT m FROM MUser m"),
    @NamedQuery(name = "MUser.findById", query = "SELECT m FROM MUser m WHERE m.id = :id"),
    @NamedQuery(name = "MUser.findByUsername", query = "SELECT m FROM MUser m WHERE m.username = :username"),
    @NamedQuery(name = "MUser.findByPassword", query = "SELECT m FROM MUser m WHERE m.password = :password"),
    @NamedQuery(name = "MUser.findByName", query = "SELECT m FROM MUser m WHERE m.name = :name"),
    @NamedQuery(name = "MUser.findBySurname", query = "SELECT m FROM MUser m WHERE m.surname = :surname"),
    @NamedQuery(name = "MUser.findByPermFile", query = "SELECT m FROM MUser m WHERE m.permFile = :permFile"),
    @NamedQuery(name = "MUser.findByPermLog", query = "SELECT m FROM MUser m WHERE m.permLog = :permLog")})
public class MUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Basic(optional = false)
    @Column(name = "Username")
    private String username;
    @Basic(optional = false)
    @Column(name = "Password")
    private String password;
    @Column(name = "Name")
    private String name;
    @Column(name = "Surname")
    private String surname;
    @Basic(optional = false)
    @Column(name = "Perm_File")
    private boolean permFile;
    @Basic(optional = false)
    @Column(name = "Perm_Log")
    private boolean permLog;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "mUser")
    private Collection<SrvCureplan> srvCureplanCollection;

    public MUser() {
    }

    public MUser(Long id) {
        this.id = id;
    }

    public MUser(Long id, String username, String password, boolean permFile, boolean permLog) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.permFile = permFile;
        this.permLog = permLog;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public boolean getPermFile() {
        return permFile;
    }

    public void setPermFile(boolean permFile) {
        this.permFile = permFile;
    }

    public boolean getPermLog() {
        return permLog;
    }

    public void setPermLog(boolean permLog) {
        this.permLog = permLog;
    }

    public Collection<SrvCureplan> getSrvCureplanCollection() {
        return srvCureplanCollection;
    }

    public void setSrvCureplanCollection(Collection<SrvCureplan> srvCureplanCollection) {
        this.srvCureplanCollection = srvCureplanCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MUser)) {
            return false;
        }
        MUser other = (MUser) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.MUser[id=" + id + "]";
    }

}
